/**
 * OilsAction.java
 *2013年9月28日下午8:53:46
 *LINKT
 */
package com.jskj.actions;

import com.jskj.bean.Oils;
import com.jskj.commons.BaseAction;
import com.jskj.dao.DaoOils;

/**
 * @author LINKT
 *
 */
public class OilsAction extends BaseAction {

        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        
        private String yp_mc;
        private String yp_hs;
        private String yp_dm;
        

        public String getYp_mc() {
                return yp_mc;
        }

        public void setYp_mc(String yp_mc) {
                this.yp_mc = yp_mc;
        }

        public String getYp_hs() {
                return yp_hs;
        }

        public void setYp_hs(String yp_hs) {
                this.yp_hs = yp_hs;
        }

        public String getYp_dm() {
                return yp_dm;
        }

        public void setYp_dm(String yp_dm) {
                this.yp_dm = yp_dm;
        }

        /**
         * 获取油品列表
         */
        public void getOilsList(){
                DaoOils daoOils=new DaoOils();
                String  s=daoOils.getOilsList();
                this.out(s);
        }
        /**
         * 新增油品
         */
        public void addOils() {
                Oils oils=new Oils();
                oils.setYp_dm(yp_dm);
                oils.setYp_mc(yp_mc);
                oils.setYp_hs(yp_hs);
                DaoOils daoOils=new DaoOils();
                if (daoOils.addOils(oils)) {
                        this.out("{\"success\":true,\"msg\":\"油品信息添加成功。\"}");
                }else {
                        this.out("{\"success\":false,\"msg\":\"油品信息添加失败,油品编号重复。\"}");
                }
                
        }
        public void modifOils() {
                Oils oils=new Oils();
                oils.setYp_dm(yp_dm);
                oils.setYp_mc(yp_mc);
                oils.setYp_hs(yp_hs);
                DaoOils daoOils=new DaoOils();
                if (daoOils.updateOils(oils)) {
                        this.out("{\"success\":true,\"msg\":\"油品信息修改成功。\"}");
                }else {
                        this.out("{\"success\":false,\"msg\":\"油品信息修改失败。\"}");
                }
        }
        public void delOils(){
                Oils oils=new Oils();
                oils.setYp_dm(yp_dm);
                oils.setYp_mc(yp_mc);
                oils.setYp_hs(yp_hs);
                DaoOils daoOils=new DaoOils();
                if (daoOils.delOils(oils)) {
                        this.out("{\"success\":true,\"msg\":\"油品信息删除成功。\"}");
                }else {
                        this.out("{\"success\":false,\"msg\":\"油品信息删除失败。\"}");
                }
        }

}
